package com.naruto.thinkmgr.bean;

import com.naruto.thinkmgr.comm.Constants;

/**
 * web工程ajax接口返回数据结构定义
 */
public class ApiResult {
    private int code;
    private String msg;
    private Object data;

    public static ApiResult ok() {
        return new ApiResult(Constants.ApiResultCode.SUCCESS, Constants.ApiResultMsg.SUCCESS);
    }

    public static ApiResult error() {
        return new ApiResult(Constants.ApiResultCode.FAIL, Constants.ApiResultMsg.FAIL);
    }

    public ApiResult(int code) {
        this(code, null);
    }

    public ApiResult(int code, String msg) {
        this(code, msg, null);
    }

    public ApiResult(int code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
